package com.devops.admin.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.devops.admin.model.DOSKubernetesResource;
import com.devops.admin.model.DOSKubernetesYamlRelation;
import com.devops.admin.model.TableResult;
import com.devops.admin.po.DOSKubernetesResourcePo;
import com.devops.admin.vo.DOSKubernetesResourceVo;
import com.devops.admin.vo.DOSNamespaceChart;
import com.devops.admin.vo.DOSPageVo;
import com.devops.common.utils.Message;

import java.util.List;

/**
 * @ClassName DOSKubernetesResourceService
 * @Description TODO
 * @Author hepingguo
 * @Date 2022/8/11 14:47
 **/
public interface DOSKubernetesResourceService extends IService<DOSKubernetesResource> {

    /**
     * @Author heyabo
     * @Description 通过yaml文件部署项目
     * @Date 14:49 2022/8/11
     * @Param [kubernetesResource]
     * @return com.devops.common.utils.Message
     **/
    Message applyProject(DOSKubernetesResourceVo kubernetesResource);

    /**
     * @Author heyabo
     * @Description 升级项目 - 通过yaml文件
     * @Date 16:35 2022/8/11
     * @Param [kubernetesResource]
     * @return com.devops.common.utils.Message
     **/
    Message upgradeProject(DOSKubernetesResourceVo kubernetesResource);

    /**
     * @Author heyabo
     * @Description 卸载项目 - 通过yaml文件
     * @Date 17:23 2022/8/11
     * @Param [kubernetesResourceId]
     * @return com.devops.common.utils.Message
     **/
    Message removeProject(Integer kubernetesResourceId);

    /**
     * @Author heyabo
     * @Description 根据项目和环境查询k8s资源信息
     * @Date 08:48 2022/8/12
     * @Param [kubernetesResource]
     * @return java.util.List<com.devops.admin.model.DOSKubernetesResource>
     **/
    List<DOSKubernetesResourcePo> getList(DOSKubernetesResourceVo kubernetesResource);

    /**
     * @Author heyabo
     * @Description 分页查询k8s列表
     * @Date 09:35 2022/8/14
     * @Param [kubernetesResource]
     * @return com.devops.admin.model.TableResult<com.devops.admin.po.DOSKubernetesResourcePo>
     **/
    TableResult<DOSKubernetesResourcePo> getPageList(DOSKubernetesResourceVo kubernetesResource, DOSPageVo pageVo);

    /**
     * @Author heyabo
     * @Description 查询yaml文件历史记录
     * @Date 11:06 2022/8/16
     * @Param [kubernetesResourceId]
     * @return java.util.List<com.devops.admin.model.DOSKubernetesYamlRelation>
     **/
    List<DOSKubernetesYamlRelation> getHistorys(Integer kubernetesResourceId);


    /**
     * 根据releaseId查询远端的连接信息
     * @param releaseId
     * @return
     */
    DOSNamespaceChart getInfoById(Integer releaseId);

    /**
     * 获取certManager info
     * @param clusterName
     * @param namespace
     * @return
     */
    Object getCertManagerInfo(String clusterName,String namespace);

    /**
     *
     * @param clusterName
     * @param namespace
     * @param certificateName
     * @return
     */
    Boolean dealCertManagerInfo(String clusterName,String namespace,String certificateName);
}
